/** 
 * @(#)ResourcesRepository.java 1.0.0 2015年11月4日 下午4:32:27  
 *  
 * Copyright © 2015 善林金融.  All rights reserved.  
 */ 

package com.repository;

import java.util.List;
import java.util.Map;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.entity.ResourcesSignRecordEntity;

/**   
 * 
 *  
 * @author  HuYaHui
 * @version $Revision:1.0.0, $Date: 2015年11月4日 下午4:32:27 $ 
 */
public interface ResourcesSignRecordRepository extends JpaRepository<ResourcesSignRecordEntity,String>{

	
//	select rsr.create_date,r.name,r.holder,rsr.sign_name,rsr.sign_reason,rsr.sign_status 
//	from RESOURCES r left join  RESOURCES_SIGN_RECORD rsr on r.id=rsr.resource_id;

	@Query("select new Map(rsr.id as id,rsr.createDate as createDate,r.name as name,r.holder as holder,rsr.signName as signName,rsr.signReason as signReason,rsr.signStatus as signStatus,rsr.rejectReason as rejectReason) from ResourcesEntity r left join r.resourcesSignRecordEntitys rsr where rsr.signName is not null and rsr.signStatus!='已归还' order by rsr.createDate desc")
	public List<Map<String,Object>> findByCondition();
	
}
